home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / UTILITIE / CONVERSI / 0825C.ZIP / 80TO86.ARC / 80T86.ASM next >
Assembly Source File  |  1985-08-14  |  31KB  |  1,346 lines

  1.  
  2. ;    ------------------------------------------------------------
  3. ;    Machine language translator - 8080 code to 8086 code
  4. ;
  5. ;         80T86 - Copyright  (C)  1984
  6. ;        Universidad Autonoma de Puebla
  7. ;
  8. ;    [Harold V. McIntosh, 28 August 1984]
  9. ;    ------------------------------------------------------------
  10.  
  11. bdos    equ    0E0H
  12.  
  13. ;    -------------
  14.     org    005CH
  15. FC80    rb    0        ;.ASM FCB
  16. ;    -------------
  17.  
  18. tsiz    equ    0080H
  19. SZ86    equ    0080H        ;size of .A86 buffer
  20. SZ80    equ    0080H        ;size of .ASM file buffer
  21.  
  22. ;    -------------
  23.     org    0080H
  24. BU80    rb    0        ;.ASM buffer
  25. ;    -------------
  26.  
  27. csiz    equ    257        ;max chars in Huffman code
  28.  
  29. ;    Nongraphic characters.
  30.  
  31. HT    equ    09H
  32. LF    equ    0AH
  33. CR    equ    0DH
  34.  
  35. ;    -------------
  36.     org    0100H
  37. ;    -------------
  38.  
  39. begn:    mov    stak,sp            ;save sp
  40.  
  41.     mov    al,FC80+1        ;.ASM FCB
  42.     cmp    al,' '
  43.     jz G001 ! jmp ntut ! G001:
  44.     mov    dx,(offset tuto)    
  45. ferm:    call    mssg
  46. exit:    mov    sp,stak
  47.     mov    dl,00
  48.     mov    cl,00
  49.     int    bdos
  50.  
  51. ntut:    mov    bx,(offset BU86)    ;.A86 buffer
  52.     mov    PT86,bx            ;pointer to .A86 buffer
  53.     mov    bx,(offset BU80)    ;.ASM buffer
  54.     mov    PT80,bx            ;.ASM file index
  55.  
  56.     mov    cx,(offset 0021H)    ;33 00's
  57.     mov    bx,(offset FC86)    ;.A86 FCB
  58.     call    fiuc            ;block fill
  59.  
  60.     mov    ch,8
  61.     mov    dx,(offset FC80+1)    
  62.     mov    bx,(offset FC86+1)    
  63.     call    miuc
  64.     mov    (byte ptr [bx]),'A'
  65.     pushf ! inc bx ! popf    
  66.     mov    (byte ptr [bx]),'8'
  67.     pushf ! inc bx ! popf    
  68.     mov    (byte ptr [bx]),'6'
  69.  
  70.     xor    al,al
  71.     mov    FC80+32,al        ;.ASM FCB
  72.     mov    dens,al            ;z/nz = un/squeezed
  73.     mov    mult,al            ;repeat factor
  74.     mov    xait,al            ;z/nz = character not/waiting
  75.  
  76.     mov    dx,(offset FC80)    ;.ASM FCB
  77.     mov    cl,15            ;(0F) open file
  78.     int    bdos
  79.     inc    al
  80.     jz G002 ! jmp opef ! G002:
  81.     mov    dx,(offset nfil)    ;'requested file not found'
  82.     jmp    ferm            ;final (error) message
  83.  
  84. opef:    mov    bx,(offset 0000)    
  85.     mov    CO80,bx
  86.     mov    bx,(offset CO86)    ;capaity of .A86 buffer
  87.     mov    (byte ptr [bx]),SZ86+1    ;size of .A86 buffer
  88.     mov    al,FC80+10
  89.     cmp    al,'Q'
  90.     jz G003 ! jmp nsqz ! G003:
  91.  
  92. cota:    call    rbyt            ;fetch one byte from input stream
  93.     cmp    al,076H
  94.     jz G004 ! jmp nsqz ! G004:
  95.     call    rbyt            ;fetch one byte from input stream
  96.     cmp    al,0FFH
  97.     jz G005 ! jmp nsqz ! G005:
  98.  
  99. ;    The "squeezed" marker is followed by a two-byte checksum,
  100. ;    which is the simple sum of all the one-byte characters in
  101. ;    the source file, carried as a two byte sum modulo 2**16.
  102.  
  103. rchk:    call    rwor            ;fetch two bytes from input stream
  104.     mov    cksm,bx            ;checksum
  105.  
  106. ;    Unsqueezed file name. It is an ASCII sequence, may be lower
  107. ;    case if SQ.COM received it in response to a prompt, ending
  108. ;    with a zero byte.
  109.  
  110. luup:    call    rbyt            ;fetch one byte from input stream
  111.     call    cona
  112.     or    al,al
  113.     jz G006 ! jmp luup ! G006:
  114.  
  115. ;    Load code dictionary. It is preceded by its two-byte length,
  116. ;    and consists of a series of pairs of two-byte addresses. For
  117. ;    each bit in the code, select the first element (0) or the
  118. ;    second (1) element of the pair. If the pair is positive, it
  119. ;    is the table entry (code + 4*index) at which to continue with
  120. ;    the next bit. If the pair is negative, it is the complement
  121. ;    of the coded ASCII character (low order byte except for [end]).
  122.  
  123. ldic:    call    rwor        ;fetch two bytes from input stream
  124.     mov    cx,(offset csiz)    
  125.     mov    al,cl
  126.     sub    al,bl
  127.     mov    al,ch
  128.     sbb    al,bh
  129.     jc G007 ! jmp ldii ! G007:
  130.     mov    dx,(offset ntab)        ;'insufficient dictionary space'
  131.     jmp    ferm        ;final (error) message
  132.  
  133. ldii:    add    bx,bx
  134.     add    bx,bx
  135.     mov    cl,bl
  136.     mov    ch,bh
  137.     mov    dx,(offset code)        ;decoding table
  138. luuq:    call    rbyt        ;fetch one byte from input stream
  139.     xchg dx,bx ! mov [bx],al ! xchg dx,bx
  140.     pushf ! inc dx ! popf    
  141.     pushf ! dec cx ! popf    
  142.     mov    al,cl
  143.     or    al,ch
  144.     jz G008 ! jmp luuq ! G008:
  145.  
  146.     call    crlf        ;type CR,LF
  147.     mov    bx,(offset roco)    
  148.     mov    (byte ptr [bx]),1
  149.     mov    bx,(offset dens)    ;z/nz = un/squeezed
  150.     mov    (byte ptr [bx]),0FFH
  151.  
  152. nsqz:    mov    cl,26        ;(1A) set DMA address
  153.     mov    dx,(offset BU86)        ;.A86 buffer
  154.     int    bdos
  155.  
  156.     mov    dx,(offset FC86)        ;.A86 FCB
  157.     mov    cl,17        ;(11) search for file
  158.     int    bdos
  159.     inc    al
  160.     jnz G009 ! jmp nexi ! G009:
  161.     mov    dx,(offset yexi)        ;'file already exists'
  162.     jmp    ferm        ;final (error) message
  163.  
  164. nexi:    mov    dx,(offset FC86)        ;.A86 FCB
  165.     mov    cl,22        ;(16) create file
  166.     int    bdos
  167.     cmp    al,0FFH
  168.     mov    dx,(offset nodi)        ;'no more directory'
  169.     jnz G010 ! jmp ferm ! G010:    ;final (error) message
  170.  
  171.     call    cbuz        ;clear output buffer to zeroes
  172.  
  173. ;    %-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%
  174.  
  175. runrun:    call    inch    ;byte from input stream
  176.     call    wrid    ;byte to output stream
  177.     cmp    al,CR
  178.     jnz G011 ! jmp runrun ! G011:
  179.     cmp    al,LF
  180.     jnz G012 ! jmp runrun ! G012:
  181.     cmp    al,1AH
  182.     jnz G013 ! jmp clof ! G013:
  183.     cmp    al,';'
  184.     jz G014 ! jmp nosc ! G014:
  185. yesc:    call    inch    ;byte from input stream
  186.     call    wrid    ;byte to output stream
  187.     cmp    al,LF
  188.     jnz G015 ! jmp runrun ! G015:
  189.     jmp    yesc
  190.  
  191. nosc:    cmp    al,HT
  192.     jnz G016 ! jmp yeht ! G016:
  193.     cmp    al,' '
  194.     jz G017 ! jmp noht ! G017:
  195. yeht:    call    anch
  196.     cmp    al,HT
  197.     jnz G018 ! jmp goht ! G018:
  198.     cmp    al,' '
  199.     jnz G019 ! jmp goht ! G019:
  200.     call    assm
  201.     jmp    runrun
  202.  
  203. goht:    call    wrid    ;byte to output stream
  204.     jmp    yeht
  205.  
  206. noht:    call    inch    ;byte from input stream
  207.     call    wrid    ;byte to output stream
  208.     cmp    al,':'
  209.     jnz G020 ! jmp yeht ! G020:
  210.     call    sepa    ;z = separator
  211.     jnz G021 ! jmp yeht ! G021:
  212.     jmp    noht
  213.  
  214. ;    %-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%-%
  215.  
  216. ;    Decode next character.
  217.  
  218. dnch:    mov    bx,(offset code)        ;decoding table
  219. dncr:    call    rbit        ;read next bit
  220.     jc G022 ! jmp dncs ! G022:    ;skip for 1, stay for 0
  221.     pushf ! inc bx ! popf    
  222.     pushf ! inc bx ! popf    
  223. dncs:    mov    dl,[bx]    ;get next offset
  224.     pushf ! inc bx ! popf    
  225.     mov    dh,[bx]
  226.     mov    al,dh
  227.     cmp    al,0FEH        ;FEFF means [end]
  228.     jnz G023 ! jmp dnct ! G023:
  229.     or    al,al
  230.     js G024 ! jmp dncu ! G024:    ;p means new offset
  231.     mov    al,dl    ;m means complemented char
  232.     not    al
  233.     stc
  234.     cmc
  235.     ret
  236.  
  237. dnct:    stc    ;flag [end] with carry bit
  238.     ret
  239.  
  240. ;    Calculate <code>+4*<offset>.
  241.  
  242. dncu:    mov    bx,(offset code)        ;decoding table
  243.     add    bx,dx
  244.     add    bx,dx
  245.     add    bx,dx
  246.     add    bx,dx
  247.     jmp    dncr
  248.  
  249. ;    Type CR, LF.
  250.  
  251. crlf:    mov    al,CR
  252.     call    cona        ;type character at console
  253.     mov    al,LF
  254.     jmp    cona        ;type character at console
  255.  
  256. ;    Type .A86 text and accumulate checksum.
  257.  
  258. wrid:    push    bx
  259.     push    dx
  260.     push    cx
  261.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  262.     mov    ch,al
  263.     mov    al,dens    ;z/nz = un/squeezed
  264.     or    al,al
  265.     jnz G025 ! jmp wrun ! G025:
  266.     mov    bx,(offset cksm)        ;checksum
  267.     mov    al,[bx]
  268.     sub    al,ch
  269.     mov    [bx],al
  270.     pushf ! inc bx ! popf    
  271.     mov    al,[bx]
  272.     sbb    al,0
  273.     mov    [bx],al
  274. wrun:    mov    al,ch
  275.     call    cona
  276.     call    wbyt        ;send character to .A86 file
  277.     pop ax ! xchg ah,al ! sahf
  278.     pop    cx
  279.     pop    dx
  280.     pop    bx
  281.     ret
  282.  
  283. ;    Upper case fold.
  284.  
  285. ucfo:    cmp    al,'a'
  286.     jnc G026 ! ret ! G026:
  287.     cmp    al,'{'
  288.     jc G027 ! ret ! G027:
  289.     and    al,5FH
  290.     ret
  291.  
  292. ;    Lower case fold.
  293.  
  294. lcin:    call    inch    ;byte from input stream
  295. lcfo:    cmp    al,'A'
  296.     jnc G028 ! ret ! G028:
  297.     cmp    al,'['
  298.     jc G029 ! ret ! G029:
  299.     or    al,20H
  300.     ret
  301.  
  302. ;    Send character in accumulator to console.
  303.  
  304. cona:    push    bx
  305.     push    dx
  306.     push    cx
  307.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  308.     mov    cl,2        ;(02) char to console
  309.     mov    dl,al
  310.     int    bdos
  311.     pop ax ! xchg ah,al ! sahf
  312.     pop    cx
  313.     pop    dx
  314.     pop    bx
  315.     ret
  316.  
  317. ;    Send message to the console.
  318.  
  319. mssg:    mov    cl,9        ;(09) print buffer
  320.     int bdos ! ret
  321.  
  322. ourg:    mov    al,[bx]
  323.     or    al,al
  324.     jnz G030 ! ret ! G030:
  325.     call    wrid    ;byte to output stream
  326.     pushf ! inc bx ! popf    
  327.     jmp    ourg    ;phrase to output stream
  328.  
  329. ;    Verify the checksum.
  330.  
  331. chek:    mov    bx,cksm            ;checksum
  332.     mov    al,bh
  333.     or    al,bl
  334.     jnz G031 ! jmp clof ! G031:    ;close the file
  335.  
  336.     mov    cl,19            ;(13) delete file
  337.     mov    dx,(offset FC86)    ;.A86 FCB
  338.     int    bdos
  339.  
  340.     mov    dx,(offset chno)    ;'Checksum failure.'
  341.     call    ferm            ;final (error) message
  342.  
  343. ;    Close .A86 file.
  344.  
  345. clof:    mov    al,CO86            ;occupancy of .A86 buffer
  346.     cmp    al,SZ86            ;size of .A86 buffer
  347.     jz G032 ! call wrdi ! G032:
  348.     mov    cl,16            ;(10) close file
  349.     mov    dx,(offset FC86)    ;.A86 FCB
  350.     int    bdos
  351.     cmp    al,0FFH
  352.     mov    dx,(offset nclo)    ;'cannot close file'
  353.     jnz G033 ! jmp ferm ! G033:    ;final (error) message
  354.     jmp    exit
  355.  
  356. ;    Read one bit at a time.
  357.  
  358. rbit:    push    bx
  359.     mov    bx,(offset roco)        ;bit rotation counter
  360.     dec    (byte ptr [bx])
  361.     jz G034 ! jmp rbiu ! G034:
  362.     mov    (byte ptr [bx]),8
  363.     call    rbyt        ;fetch one byte from input stream
  364.     mov    roby,al    ;rotating byte
  365. rbiu:    mov    al,roby        ;rotating byte
  366.     rcr    al,1
  367.     mov    roby,al    ;rotating byte
  368.     pop    bx
  369.     ret
  370.  
  371. ;    Read one word.
  372.  
  373. rwor:    call    rbyt        ;fetch one byte from input stream
  374.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  375.     call    rbyt        ;fetch one byte from input stream
  376.     pop    bx
  377.     mov    bl,bh
  378.     mov    bh,al
  379.     ret
  380.  
  381. ;    Fetch the next byte. The input buffer will be refreshed if it
  382. ;    is necessary. For normal files, one byte will be extracted from
  383. ;    the input buffer; for squeezed files, one byte will be decoded
  384. ;    from the incoming bit stream and subtracted from the checksum.
  385.  
  386. inch:    mov    bx,(offset xait)    ;z/nz = character not/waiting
  387.     mov    al,[bx]
  388.     or    al,al
  389.     jnz G035 ! jmp gech ! G035:
  390.     mov    al,wach    ;waiting character
  391.     mov    (byte ptr [bx]),00
  392.     ret
  393.  
  394. anch:    mov    al,0FFH
  395.     mov    xait,al    ;z/nz = character not/waiting
  396.     call    gech
  397.     mov    wach,al    ;waiting character
  398.     ret
  399.  
  400. gech:    mov    al,dens    ;z/nz = un/squeezed
  401.     or    al,al
  402.     jnz G036 ! jmp rbyt ! G036:    ;fetch one byte
  403.     mov    al,mult    ;repeat factor
  404.     or    al,al
  405.     jnz G037 ! jmp gusq ! G037:
  406.     dec    al
  407.     mov    mult,al    ;repeat factor
  408.     mov    al,lach
  409.     ret
  410.  
  411. gusq:    call    dnch
  412.     jc G038 ! jmp guss ! G038:
  413.     mov    al,1AH
  414.     ret
  415.  
  416. guss:    cmp    al,090H
  417.     jnz G039 ! jmp gusu ! G039:
  418.     mov    lach,al
  419.     ret
  420.  
  421. gusu:    call    dnch
  422.     or    al,al
  423.     jz G040 ! jmp gusv ! G040:
  424.     mov    al,090H
  425.     ret
  426.  
  427. gusv:    dec    al
  428.     dec    al
  429.     mov    mult,al    ;repeat factor
  430.     mov    al,lach
  431.     ret
  432.  
  433. ;    Read one byte, refill buffer as needed.
  434.  
  435. rbyt:    push    bx
  436.     mov    bx,CO80        ;byte counter - input buffer
  437.     mov    al,bl
  438.     or    al,bh
  439.     jz G041 ! jmp rbyu ! G041:
  440.     call    rdsk
  441.     mov    bx,(offset BU80)        ;.ASM buffer
  442.     mov    PT80,bx    ;byte pointer - input buffer
  443.     mov    bx,(offset SZ80)        ;size of .ASM file buffer
  444. rbyu:    pushf ! dec bx ! popf    
  445.     mov    CO80,bx    ;byte counter - input buffer
  446.     mov    bx,PT80        ;byte pointer - input buffer
  447.     mov    al,[bx]
  448.     pushf ! inc bx ! popf    
  449.     mov    PT80,bx    ;byte pointer - input buffer
  450.     pop    bx
  451.     ret
  452.  
  453. ;    Insert byte in .A86 buffer.
  454.  
  455. wbyt:    push    bx
  456.     mov    bx,(offset CO86)        ;occupancy of .A86 buffer
  457.     dec    (byte ptr [bx])
  458.     jz G042 ! jmp wbyy ! G042:
  459.     mov    (byte ptr [bx]),SZ86        ;size of .A86 buffer
  460.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  461.     mov    bx,(offset BU86)        ;.A86 buffer
  462.     mov    PT86,bx    ;pointer to .A86 buffer
  463.     call    wrdi
  464.     call    cbuz        ;clear output buffer to zeroes
  465.     pop ax ! xchg ah,al ! sahf
  466. wbyy:    mov    bx,PT86        ;pointer to .A86 buffer
  467.     mov    [bx],al
  468.     pushf ! inc bx ! popf    
  469.     mov    PT86,bx    ;pointer to .A86 buffer
  470.     pop    bx
  471.     ret
  472.  
  473. ;    Send BU86 to disk.
  474.  
  475. wrdi:    mov    cl,26        ;(1A) set DMA address
  476.     mov    dx,(offset BU86)        ;.A86 buffer
  477.     int    bdos
  478.  
  479.     mov    cl,21        ;(15) write one record
  480.     mov    dx,(offset FC86)        ;.A86 DCB
  481.     int    bdos
  482.     cmp    al,00H
  483.     mov    dx,(offset werr)        ;'disk write'
  484.     jz G043 ! jmp ferm ! G043:    ;final (error) message
  485.     ret
  486.  
  487. rdsk:    push    bx
  488.     push    dx
  489.     push    cx
  490.  
  491.     mov    cl,26        ;(1A) set DMA address
  492.     mov    dx,(offset BU80)        ;.ASM buffer
  493.     int    bdos
  494.  
  495.     mov    cl,20        ;(14) read one record
  496.     mov    dx,(offset FC80)        ;.ASM FCB
  497.     int    bdos
  498.  
  499.     pop    cx
  500.     pop    dx
  501.     pop    bx
  502.     ret
  503.  
  504. ;    Fill BU86 with zeroes.
  505.  
  506. cbuz:    xor    al,al
  507.     mov    ch,1        ;one sector in buffer
  508.     mov    bx,(offset BU86)        ;.A86 buffer
  509. cbuy:    mov    cl,tsiz        ;record size
  510. cbux:    mov    [bx],al
  511.     pushf ! inc bx ! popf    
  512.     dec    cl
  513.     jz G044 ! jmp cbux ! G044:
  514.     dec    ch
  515.     jz G045 ! jmp cbuy ! G045:
  516.     ret
  517.  
  518. ;    Block fill with C B's starting at (HL).
  519.  
  520. fiuc:    mov    [bx],ch
  521.     pushf ! inc bx ! popf    
  522.     dec    cl
  523.     jz G046 ! jmp fiuc ! G046:    ;block fill
  524.     ret
  525.  
  526. miuc:    xchg dx,bx ! mov al,[bx] ! xchg dx,bx
  527.     mov    [bx],al
  528.     pushf ! inc bx ! popf    
  529.     pushf ! inc dx ! popf    
  530.     dec    ch
  531.     jz G047 ! jmp miuc ! G047:
  532.     ret
  533.  
  534. ;    Assemble the 8080 source code.
  535.  
  536. assm:    call    alfa
  537.     jmp    opco
  538.  
  539. ;    Read an alpha field by ignoring leading separators,
  540. ;    storing letters in registers C,D,E, and terminating
  541. ;    reading when a separator is again encountered.  All
  542. ;    fields are held to three letters, so that the only
  543. ;    letters in a chain that are stored are the first,
  544. ;    second, and last.
  545.  
  546. alfa:    mov    dx,2020H
  547. ala:    call    lcin
  548.     call    sepa    ;z = separator
  549.     jnz G048 ! jmp ala ! G048:
  550.     mov    cl,al
  551.     call    lcin
  552.     call    sepa    ;z = separator
  553.     jnz G049 ! ret ! G049:
  554.     mov    dh,al
  555. alb:    call    lcin
  556.     call    sepa    ;z = separator
  557.     jnz G050 ! ret ! G050:
  558.     mov    dl,al
  559.     jmp    alb
  560.  
  561. ;    Read an alpha field with the intention of keeping only
  562. ;    the last letter in the field.  Otherwise the same rules
  563. ;    apply as in the subroutine alfa: leading separators
  564. ;    are ignored, trailing separators terminate.
  565.  
  566. beta:    call    lcin
  567.     call    sepa    ;z = separator
  568.     jnz G051 ! jmp beta ! G051:
  569. bet:    mov    ch,al
  570.     call    lcin
  571.     call    sepa    ;z = separator
  572.     jz G052 ! jmp bet ! G052:
  573.     mov    sepr,al
  574.     mov    al,ch
  575.     ret
  576.  
  577. ;    Test for separators or delimiters.  The character to be
  578. ;    tested is in the accumulator, where it remains.  A zero
  579. ;    flag means it was a separator.
  580.  
  581. sepa:    cmp    al,' '
  582.     jnz G053 ! ret ! G053:
  583.     cmp    al,','
  584.     jnz G054 ! ret ! G054:
  585.     cmp    al,HT
  586.     jnz G055 ! ret ! G055:
  587.     cmp    al,CR
  588.     jnz G056 ! ret ! G056:
  589.     cmp    al,LF
  590.     ret
  591.  
  592. ;    Locate the operation codes.  A simple linear search is
  593. ;    made of some sixty mnemonics, grouping them mostly in
  594. ;    sets of eight because their position within an octet
  595. ;    translates directly into a source or destination field
  596. ;    in the 2-3-3 decomposition of INTEL 8080 opcodes.
  597.  
  598. opco:    mov    ch,12
  599.     mov    bx,(offset T4)    ;Quadrant 0 with minor modifications
  600.     call    mnem
  601.     js G057 ! jmp Q0 ! G057:
  602.     mov    ch,01
  603.     mov    bx,(offset T0)    ;Quadrant 1: interregister movements
  604.     call    mnem
  605.     js G058 ! jmp Q1 ! G058:
  606.     mov    ch,08
  607.     mov    bx,(offset T1)    ;Quadrant 3: arithmetic-logical
  608.     call    mnem
  609.     js G059 ! jmp Q2 ! G059:
  610.     mov    ch,08
  611.     mov    bx,(offset T2)    ;Quadrant 2, column 6: immediate
  612.     call    mnem
  613.     js G060 ! jmp B6 ! G060:
  614.     mov    ch,9
  615.     mov    bx,(offset T4@1)    ;All the one-byte sporadic opcodes
  616.     call    mnem
  617.     js G061 ! jmp gg ! G061:
  618.     mov    ch,2
  619.     mov    bx,(offset T4@2)    ;All the two-byte sporadic opcodes
  620.     call    mnem
  621.     js G062 ! jmp tt ! G062:
  622.     mov    ch,4
  623.     mov    bx,(offset T4@3)    ;All the three byte sporadic opcodes
  624.     call    mnem
  625.     js G063 ! jmp uu ! G063:
  626.     mov    ch,2
  627.     mov    bx,(offset T5)    
  628.     call    mnem
  629.     js G064 ! jmp vv ! G064:
  630.     mov    ch,08
  631.     mov    bx,(offset T3)    ;Quadrant 0, column 7: accumulator
  632.     call    mnem
  633.     js G065 ! jmp A7 ! G065:
  634.     mov    al,cl
  635.     cmp    al,'r'
  636.     jnz G066 ! jmp B0 ! G066:    ;Quadrant 3, column 0: returns
  637.     cmp    al,'j'
  638.     jnz G067 ! jmp B2 ! G067:    ;Quadrant 3, column 2: jumps
  639.     cmp    al,'c'
  640.     jnz G068 ! jmp B4 ! G068:    ;Quadrant 3, column 4: calls
  641.     mov    ch,6
  642.     mov    bx,(offset T7)    ;Assembler directives
  643.     call    mnem
  644.     js G069 ! jmp qd ! G069:
  645.     jmp    none    ;error - unrecognizable code
  646.  
  647. Q0:    call    juta
  648.     dw    A0    ;pop  pair
  649.     dw    A3    ;lxi  pair,addr
  650.     dw    A2    ;stax pair  - beware - only b, d legal
  651.     dw    A1    ;inx  pair
  652.     dw    A4    ;inr  register
  653.     dw    A4    ;dcr  register
  654.     dw    A4    ;mvi  register,data
  655.     dw    B7    ;rst  digit in opcode
  656.     dw    A0    ;push pair
  657.     dw    A0    ;dad  pair
  658.     dw    A2    ;ldax pair  - beware - only b, d legal
  659.     dw    A1    ;dcx  pair
  660.  
  661. A0:    lahf ! xchg ah,al ! push ax ! xchg ah,al
  662.     call    beta
  663.     cmp    al,'w'
  664.     jnz G070 ! jmp A0@1 ! G070:
  665.     pop    cx
  666.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  667.     mov    al,ch
  668.     mov    dx,(offset QZ86)    
  669.     call    meta    ;locate numbered phrase
  670.     call    ourg    ;phrase to output stream
  671.     pop ax ! xchg ah,al ! sahf
  672.     call    pair    ;identify register pair
  673.     mov    al,[bx]
  674.     call    wrid    ;byte to output stream
  675.     pushf ! inc bx ! popf    
  676.     mov    al,[bx]
  677.     call    wrid    ;byte to output stream
  678.     jmp    rest    ;comment to output stream
  679.  
  680. A0@1:    pop ax ! xchg ah,al ! sahf
  681.     or    al,al
  682.     jnz G071 ! jmp A0@2 ! G071:
  683.     mov    bx,(offset QZ86@C)    
  684.     jmp    A0@3
  685. A0@2:    mov    bx,(offset QZ86@D)    
  686. A0@3:    call    ourg    ;phrase to output stream
  687.     jmp    rest    ;comment to output stream
  688.  
  689. A1:    mov    dx,(offset QZ86)    
  690.     call    meta    ;locate numbered phrase
  691.     call    ourg    ;phrase to output stream
  692.     push    bx
  693.     call    beta
  694.     call    pair    ;identify register pair
  695.     mov    al,[bx]
  696.     call    wrid    ;byte to output stream
  697.     pushf ! inc bx ! popf    
  698.     mov    al,[bx]
  699.     call    wrid    ;byte to output stream
  700.     pop    bx
  701.     pushf ! inc bx ! popf    
  702.     call    ourg    ;phrase to output stream
  703.     jmp    rest    ;comment to output stream
  704.  
  705. A2:    mov    dx,(offset QZ86)    
  706.     call    meta    ;locate numbered phrase
  707.     call    ourg    ;phrase to output stream
  708.     push    bx
  709.     call    beta
  710.     call    pair    ;identify register pair
  711.     push    bx
  712.     mov    al,[bx]
  713.     call    wrid    ;byte to output stream
  714.     pushf ! inc bx ! popf    
  715.     mov    al,[bx]
  716.     call    wrid    ;byte to output stream
  717.     pop    bx
  718.     xchg sp,bp ! xchg bx,[bp] ! xchg sp,bp
  719.     pushf ! inc bx ! popf    
  720.     call    ourg    ;phrase to output stream
  721.     xchg sp,bp ! xchg bx,[bp] ! xchg sp,bp
  722.     mov    al,[bx]
  723.     call    wrid    ;byte to output stream
  724.     pushf ! inc bx ! popf    
  725.     mov    al,[bx]
  726.     call    wrid    ;byte to output stream
  727.     pop    bx
  728.     pushf ! inc bx ! popf    
  729.     call    ourg    ;phrase to output stream
  730.     jmp    resu    ;rest of line to output
  731.  
  732. A3:    mov    dx,(offset QZ86)    
  733.     call    meta    ;locate numbered phrase
  734.     call    ourg    ;phrase to output stream
  735.     push    bx
  736.     call    beta
  737.     call    pair    ;identify register pair
  738.     mov    al,[bx]
  739.     call    wrid    ;byte to output stream
  740.     pushf ! inc bx ! popf    
  741.     mov    al,[bx]
  742.     call    wrid    ;byte to output stream
  743.     pop    bx
  744.     pushf ! inc bx ! popf    
  745.     call    ourg    ;phrase to output stream
  746.     push    bx
  747.     call    addq    ;read address field
  748.     pop    bx
  749.     pushf ! inc bx ! popf    
  750.     call    ourg    ;phrase to output stream
  751.     jmp    resu    ;rest of line to output
  752.  
  753. A4:    mov    dx,(offset QZ86)    
  754.     call    meta    ;locate numbered phrase
  755.     call    ourg    ;phrase to output stream
  756.     call    sreg
  757.     mov    al,sepr
  758.     call    wrid    ;byte to output stream
  759.     jmp    resu    ;rest of line to output
  760.  
  761. A7:    mov    dx,(offset AC86)    
  762.     call    meta    ;locate numbered phrase
  763.     call    ourg    ;phrase to output stream
  764.     jmp    rest    ;comment to output stream
  765.  
  766. Q1:    mov    bx,(offset MO86)    
  767.     call    ourg    ;phrase to output stream
  768.     call    rreg    ;identify register
  769.     mov    al,','
  770.     call    wrid    ;byte to output stream
  771.     call    rreg    ;identify register
  772.     jmp    rest    ;comment to output stream
  773.  
  774. Q2:    mov    bl,al
  775.     mov    bh,0
  776.     add    bx,bx
  777.     add    bx,bx
  778.     add    bx,bx
  779.     mov    dx,(offset IM86)    
  780.     add    bx,dx
  781.     call    ourg    ;phrase to output stream
  782.     call    rreg    ;identify register
  783.     jmp    resu    ;rest of line to output
  784.  
  785. gg:    mov    dx,(offset NB86)    
  786.     call    meta    ;locate numbered phrase
  787.     call    ourg    ;phrase to output stream
  788.     jmp    rest    ;comment to output stream
  789.  
  790. tt:    mov    dx,(offset WB86)    
  791.     call    meta    ;locate numbered phrase
  792.     call    ourg    ;phrase to output stream
  793.     jmp    resu    ;rest of line to output
  794.  
  795. uu:    mov    dx,(offset HB86)    
  796.     call    meta    ;locate numbered phrase
  797.     call    ourg    ;phrase to output stream
  798.     jmp    resu    ;rest of line to output
  799.  
  800. vv:    mov    dx,(offset IB86)    
  801.     call    meta    ;locate numbered phrase
  802.     call    ourg    ;phrase to output stream
  803.     push    bx
  804.     call    addq    ;read address field
  805.     pop    bx
  806.     pushf ! inc bx ! popf    
  807.     call    ourg    ;phrase to output stream
  808.     jmp    rest    ;comment to output stream
  809.  
  810. B0:    call    bb
  811.     mov    bx,(offset CR86)    
  812.     call    ourg    ;phrase to output stream
  813.     jmp    ff
  814.  
  815. B2:    call    bb
  816.     mov    bx,(offset CJ86)    
  817.     call    ourg    ;phrase to output stream
  818.     call    addq    ;read address field
  819.     jmp    ff
  820.  
  821. B4:    call    bb
  822.     mov    bx,(offset CC86)    
  823.     call    ourg    ;phrase to output stream
  824.     call    addq    ;read address field
  825.     jmp    ff
  826.  
  827. bb:    mov    cl,' '
  828.     mov    ch,08
  829.     mov    bx,(offset T6)    
  830.     call    mnem
  831.     jns G072 ! jmp none ! G072:    ;error - unrecognizable code
  832.     mov    bl,al
  833.     mov    dl,al
  834.     mov    bh,0
  835.     mov    dh,0
  836.     add    bx,bx
  837.     add    bx,bx
  838.     add    bx,dx
  839.     mov    dx,(offset CN86)    
  840.     add    bx,dx
  841.     call    ourg    ;phrase to output stream
  842.     call    incr    ;increment gensym
  843.     mov    bx,(offset gsym)    ;gensym #
  844.     call    ourg    ;phrase to output stream
  845.     mov    bx,(offset excl)    
  846.     jmp    ourg    ;phrase to output stream
  847.  
  848. ff:    mov    bx,(offset excl)    
  849.     call    ourg    ;phrase to output stream
  850.     mov    bx,(offset gsym)    ;gensym #
  851.     call    ourg    ;phrase to output stream
  852.     mov    al,':'
  853.     call    wrid    ;byte to output stream
  854.     jmp    rest    ;comment to output stream
  855.  
  856. B6:    mov    bl,al
  857.     mov    bh,0
  858.     add    bx,bx
  859.     add    bx,bx
  860.     add    bx,bx
  861.     mov    dx,(offset IM86)    
  862.     add    bx,dx
  863.     call    ourg    ;phrase to output stream
  864.     jmp    resu    ;rest of line to output
  865.  
  866. B7:    mov    bx,(offset QZ86@7)    
  867.     call    ourg    ;phrase to output stream
  868.     jmp    resu    ;rest of line to output
  869.  
  870. qd:    call    juta
  871.     dw    D0    ;data byte
  872.     dw    D1    ;data word
  873.     dw    D2    ;data space
  874.     dw    D3    ;equivalence
  875.     dw    D4    ;origin
  876.     dw    D5    ;end
  877.  
  878. D0:    mov    bx,(offset DB86)    
  879.     call    ourg    ;phrase to output stream
  880.     jmp    resu    ;rest of line to output
  881.  
  882. D1:    mov    bx,(offset DW86)    
  883.     call    ourg    ;phrase to output stream
  884.     jmp    resu    ;rest of line to output
  885.  
  886. D2:    call    inch    ;byte from input stream
  887.     cmp    al,HT
  888.     jnz G073 ! jmp D2 ! G073:
  889.     cmp    al,' '
  890.     jnz G074 ! jmp D2 ! G074:
  891.     cmp    al,'2'
  892.     jnz G075 ! jmp D2@0 ! G075:
  893.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  894.     mov    bx,(offset RB86)    
  895.     call    ourg    ;phrase to output stream
  896.     pop ax ! xchg ah,al ! sahf
  897.     call    wrid    ;byte to output stream
  898.     jmp    resu    ;rest of line to output
  899.  
  900. D2@0:    call    inch    ;byte from input stream
  901.     call    sepa    ;z = separator
  902.     jnz G076 ! jmp D2@1 ! G076:
  903.     lahf ! xchg ah,al ! push ax ! xchg ah,al
  904.     mov    bx,(offset RB86)    
  905.     call    ourg    ;phrase to output stream
  906.     mov    al,'2'
  907.     call    wrid    ;byte to output stream
  908.     pop ax ! xchg ah,al ! sahf
  909.     call    wrid    ;byte to output stream
  910.     jmp    resu    ;rest of line to output
  911.  
  912. D2@1:    mov    bx,(offset RW86)    
  913.     call    ourg    ;phrase to output stream
  914.     jmp    resu    ;rest of line to output
  915.  
  916.  
  917. D3:    mov    bx,(offset EQ86)    
  918.     call    ourg    ;phrase to output stream
  919.     jmp    rest    ;comment to output stream
  920.  
  921. D4:    mov    bx,(offset OR86)    
  922.     call    ourg    ;phrase to output stream
  923.     jmp    rest    ;comment to output stream
  924.  
  925. D5:    mov    bx,(offset EN86)    
  926.     call    ourg    ;phrase to output stream
  927.     call    rest    ;comment to output stream
  928.     jmp    clof
  929.  
  930. ;    The only errors recognized are unintelligible registers
  931. ;    or mnemonics.
  932.  
  933. none:    mov    bx,(offset ER86)    
  934.     call    ourg    ;phrase to output stream
  935.     jmp    rest    ;comment to output stream
  936.  
  937. ;    Finish out a line.
  938. ;      rest for comments
  939. ;      resu for parameters
  940.  
  941. rest:    call    inch    ;byte from input stream
  942.     cmp    al,HT
  943.     jnz G077 ! jmp rest ! G077:    ;comment to output stream
  944.     cmp    al,' '
  945.     jnz G078 ! jmp rest ! G078:    ;comment to output stream
  946.     cmp    al,CR
  947.     jnz G079 ! jmp rest ! G079:    ;comment to output stream
  948.     cmp    al,LF
  949.     jz G080 ! jmp ress ! G080:
  950.     mov    al,CR
  951.     call    wrid    ;byte to output stream
  952.     mov    al,LF
  953.     jmp    wrid    ;byte to output stream
  954.  
  955. ress:    lahf ! xchg ah,al ! push ax ! xchg ah,al
  956.     mov    al,HT
  957.     call    wrid    ;byte to output stream
  958.     pop ax ! xchg ah,al ! sahf
  959.     call    wrid    ;byte to output stream
  960. resu:    call    inch    ;byte from input stream
  961.     cmp    al,CR
  962.     jnz G081 ! jmp resu ! G081:    ;rest of line to output
  963.     cmp    al,LF
  964.     jnz G082 ! jmp resv ! G082:
  965.     call    wrid    ;byte to output stream
  966.     jmp    resu    ;rest of line to output
  967.  
  968. resv:    mov    al,CR
  969.     call    wrid    ;byte to output stream
  970.     mov    al,LF
  971.     jmp    wrid    ;byte to output stream
  972.  
  973. ;    Read an address or other two-byte field.
  974.  
  975. addq:    call    inch    ;byte from input stream
  976.     cmp    al,HT
  977.     jnz G083 ! jmp addq ! G083:    ;read address field
  978.     cmp    al,' '
  979.     jnz G084 ! jmp addq ! G084:    ;read address field
  980. addr:    call    wrid    ;byte to output stream
  981.     call    inch    ;byte from input stream
  982.     call    sepa    ;z = separator
  983.     jz G085 ! jmp addr ! G085:
  984.     ret
  985.  
  986. ;    Increment gensym counter.
  987.  
  988. incr:    mov    bx,(offset gsym+3)    
  989. incs:    mov    al,[bx]
  990.     or    al,30H
  991.     inc    al
  992.     mov    [bx],al
  993.     cmp    al,':'
  994.     jz G086 ! ret ! G086:
  995.     mov    (byte ptr [bx]),'0'
  996.     pushf ! dec bx ! popf    
  997.     jmp    incs
  998.  
  999. ;    Find the address of the nth message, when DE points to the
  1000. ;    message address table and A is the number of the message.
  1001.  
  1002. meta:    mov    bl,al
  1003.     mov    bh,0
  1004.     add    bx,bx
  1005.     add    bx,dx
  1006.     mov    dl,[bx]
  1007.     pushf ! inc bx ! popf    
  1008.     mov    dh,[bx]
  1009.     xchg    dx,bx
  1010.     ret
  1011.  
  1012. ;    Jump to the nth address in the table following the call
  1013. ;    to juta, where n is located in the accumulator.  The
  1014. ;    value of the accumulator is conserved in register c.
  1015.  
  1016. juta:    pop    bx
  1017.     mov    cl,al
  1018.     add    al,al
  1019.     add    al,bl
  1020.     mov    bl,al
  1021.     mov    al,bh
  1022.     adc    al,00H
  1023.     mov    bh,al
  1024.     mov    al,cl
  1025.     mov    dl,[bx]
  1026.     pushf ! inc bx ! popf    
  1027.     mov    dh,[bx]
  1028.     xchg    dx,bx
  1029.     jmp    bx
  1030.  
  1031. ;    Find numerical equivalents for register designations.
  1032. ;    Source registers are reported at their true value, but
  1033. ;    destination registers are multiplied by eight to have
  1034. ;    their value positioned correctly for its field.
  1035.  
  1036. rreg:    call    beta
  1037.     mov    ch,08H
  1038.     mov    bx,(offset tr)    
  1039.     call    regi    ;identify register
  1040.     jns G087 ! jmp none ! G087:    ;error - unrecognizable code
  1041.     mov    bx,(offset RGEM)    
  1042.     cmp    al,06
  1043.     jnz G088 ! jmp ourg ! G088:    ;phrase to output stream
  1044.     mov    bx,(offset RG86)    
  1045.     mov    dl,al
  1046.     mov    dh,0
  1047.     add    bx,dx
  1048.     add    bx,dx
  1049.     add    bx,dx
  1050.     jmp    ourg    ;phrase to output stream
  1051.  
  1052. sreg:    call    beta
  1053.     mov    ch,08H
  1054.     mov    bx,(offset tr)    
  1055.     call    regi    ;identify register
  1056.     jns G089 ! jmp none ! G089:    ;error - unrecognizable code
  1057.     mov    bx,(offset RGEN)    
  1058.     cmp    al,06
  1059.     jnz G090 ! jmp ourg ! G090:    ;phrase to output stream
  1060.     mov    bx,(offset RG86)    
  1061.     mov    dl,al
  1062.     mov    dh,0
  1063.     add    bx,dx
  1064.     add    bx,dx
  1065.     add    bx,dx
  1066.     jmp    ourg    ;phrase to output stream
  1067.  
  1068. ;    Find numerical equivalents for register pair symbols.
  1069. ;    They always left-pack their destination field.
  1070.  
  1071. pair:    mov    ch,05H
  1072.     mov    bx,(offset tp)    
  1073.     call    regi    ;identify register
  1074.     jns G091 ! jmp none ! G091:    ;error - unrecognizable code
  1075.     mov    bl,al
  1076.     mov    bh,0
  1077.     add    bx,bx
  1078.     mov    dx,(offset PA86)    
  1079.     add    bx,dx
  1080.     ret
  1081.  
  1082. ;    Search a list of bytes whose origin is contained in
  1083. ;    in HL to find the one, if any, which matches the
  1084. ;    accumulator.  The length of the list in is B on entry;
  1085. ;    on exit A contains either the position or FF if no
  1086. ;    match was found.
  1087.  
  1088. regi:    pushf ! dec bx ! popf    
  1089.     cmp    al,[bx]
  1090.     jnz G092 ! jmp reg ! G092:
  1091.     dec    ch
  1092.     jz G093 ! jmp regi ! G093:    ;identify register
  1093. reg:    xor    al,al
  1094.     dec    ch
  1095.     or    al,ch
  1096.     ret
  1097.  
  1098. ;    Search a table of three-letter mnemonics to find the
  1099. ;    code contained in registers C,D,E.  Enter with the
  1100. ;    table origin in pair HL, the table size N in the
  1101. ;    accumulator.  On exit the accumulator will contain
  1102. ;    either the position, ranging between 0 and N-1, of
  1103. ;    the item in the table, or else FF(hex) if it was not
  1104. ;    found.
  1105.  
  1106. mnem:    pushf ! dec bx ! popf    
  1107.     mov    al,[bx]
  1108.     cmp    al,dl
  1109.     jz G094 ! jmp mnb ! G094:
  1110.     pushf ! dec bx ! popf    
  1111.     mov    al,[bx]
  1112.     cmp    al,dh
  1113.     jz G095 ! jmp mnc ! G095:
  1114.     pushf ! dec bx ! popf    
  1115.     mov    al,[bx]
  1116.     sub    al,cl
  1117.     jz G096 ! jmp mnd ! G096:
  1118. mna:    dec    ch
  1119.     or    al,ch
  1120.     ret
  1121. mnb:    pushf ! dec bx ! popf    
  1122. mnc:    pushf ! dec bx ! popf    
  1123. mnd:    dec    ch
  1124.     jz G097 ! jmp mnem ! G097:
  1125.     jmp    mna
  1126.  
  1127. ;    Table of mnemonics grouped by octets and dodecuplets.
  1128.  
  1129.     db    'bcdehlma'
  1130. tr    db    'bdhpw'
  1131. tp    db    'mov'
  1132. T0    db    'add','adc','sub','sbb'
  1133.     db    'ana','xra','ora','cmp'
  1134. T1    db    'adi','aci','sui','sbi'
  1135.     db    'ani','xri','ori','cpi'
  1136. T2    db    'rlc','rrc','ral','rar'
  1137.     db    'daa','cma','stc','cmc'
  1138. T3    db    'pop','lxi','stx','inx'
  1139.     db    'inr','dcr','mvi','rst'
  1140.     db    'puh','dad','ldx','dcx'
  1141. T4    db    'nop','ret','pcl','spl'
  1142.     db    'xtl','xcg','di ','ei '
  1143.     db    'hlt'
  1144. T4@1    db    'out','in '
  1145. T4@2    db    'jmp','cal','lda','lhd'
  1146. T4@3    db    'sta','shd'
  1147. T5    db    ' nz',' z ',' nc',' c '
  1148.     db    ' po',' pe',' p ',' m '
  1149. T6    db    'db ','dw ','ds ','equ','org','end'
  1150. T7    rb    0
  1151.  
  1152. RG86    db    'ch',00
  1153.     db    'cl',00
  1154.     db    'dh',00
  1155.     db    'dl',00
  1156.     db    'bh',00
  1157.     db    'bl',00
  1158.     db    '..',00
  1159.     db    'al',00
  1160. RGEM    db    '[bx]',00
  1161. RGEN    db    '(byte ptr [bx])',0
  1162.  
  1163. PA86    db    'cx'
  1164.     db    'dx'
  1165.     db    'bx'
  1166.     db    'sp'
  1167.     db    'ax'
  1168.  
  1169. QZ86    dw    QZ86@0
  1170.     dw    QZ86@1
  1171.     dw    QZ86@2
  1172.     dw    QZ86@3
  1173.     dw    QZ86@4
  1174.     dw    QZ86@5
  1175.     dw    QZ86@6
  1176.     dw    QZ86@7
  1177.     dw    QZ86@8
  1178.     dw    QZ86@9
  1179.     dw    QZ86@A
  1180.     dw    QZ86@B
  1181.  
  1182. QZ86@0    db    'pop',HT,0
  1183. QZ86@1    db    'mov',HT,0,',(offset ',0,')',HT,0
  1184. QZ86@2    db    'xchg ',0,',bx ! mov [bx],al ! xchg ',0,',bx',0
  1185. QZ86@3    db    'pushf ! inc ',0,' ! popf',HT,0
  1186. QZ86@4    db    'inc',HT,0
  1187. QZ86@5    db    'dec',HT,0
  1188. QZ86@6    db    'mov',HT,0
  1189. QZ86@7    db    'call',HT,'offset 8*',0
  1190. QZ86@8    db    'push',HT,0
  1191. QZ86@9    db    'add',HT,'bx,',0
  1192. QZ86@A    db    'xchg ',0,',bx ! mov al,[bx] ! xchg ',0,',bx',0
  1193. QZ86@B    db    'pushf ! dec ',0,' ! popf',HT,0
  1194.  
  1195. QZ86@C    db    'lahf ! xchg ah,al ! push ax ! xchg ah,al',0
  1196. QZ86@D    db    'pop ax ! xchg ah,al ! sahf',0
  1197.  
  1198. MO86    db    'mov',HT,00
  1199.  
  1200. IM86    db    'add',HT,'al,',00
  1201.     db    'adc',HT,'al,',00
  1202.     db    'sub',HT,'al,',00
  1203.     db    'sbb',HT,'al,',00
  1204.     db    'and',HT,'al,',00
  1205.     db    'xor',HT,'al,',00
  1206.     db    'or',HT,'al,',00,00
  1207.     db    'cmp',HT,'al,',00
  1208.  
  1209. AC86    dw    AC86@0
  1210.     dw    AC86@1
  1211.     dw    AC86@2
  1212.     dw    AC86@3
  1213.     dw    AC86@4
  1214.     dw    AC86@5
  1215.     dw    AC86@6
  1216.     dw    AC86@7
  1217.  
  1218. AC86@0    db    'rol',HT,'al,1',0
  1219. AC86@1    db    'ror',HT,'al,1',0
  1220. AC86@2    db    'rcl',HT,'al,1',0
  1221. AC86@3    db    'rcr',HT,'al,1',0
  1222. AC86@4    db    'daa',0
  1223. AC86@5    db    'not',HT,'al',0
  1224. AC86@6    db    'stc',0
  1225. AC86@7    db    'cmc',0
  1226.  
  1227. NB86    dw    NB86@0
  1228.     dw    NB86@1
  1229.     dw    NB86@2
  1230.     dw    NB86@3
  1231.     dw    NB86@4
  1232.     dw    NB86@5
  1233.     dw    NB86@6
  1234.     dw    NB86@7
  1235.     dw    NB86@8
  1236.  
  1237. NB86@0    db    'nop',0
  1238. NB86@1    db    'ret',0
  1239. NB86@2    db    'jmp',HT,'bx',0
  1240. NB86@3    db    'mov',HT,'sp,bx',0
  1241. NB86@4    db    'xchg sp,bp ! xchg bx,[bp] ! xchg sp,bp',0
  1242. NB86@5    db    'xchg',HT,'dx,bx',0
  1243. NB86@6    db    'di',0
  1244. NB86@7    db    'ei',0
  1245. NB86@8    db    'hlt',0
  1246.  
  1247. WB86    dw    WB86@0
  1248.     dw    WB86@1
  1249.  
  1250. WB86@0    db    'out',HT,'al,',0
  1251. WB86@1    db    'in',HT,'al,',0
  1252.  
  1253. HB86    dw    HB86@0
  1254.     dw    HB86@1
  1255.     dw    HB86@2
  1256.     dw    HB86@3
  1257.  
  1258. HB86@0    db    'jmp',HT,0
  1259. HB86@1    db    'call',HT,0
  1260. HB86@2    db    'mov',HT,'al,',0
  1261. HB86@3    db    'mov',HT,'bx,',0
  1262.  
  1263. IB86    dw    IB86@0
  1264.     dw    IB86@1
  1265.  
  1266. IB86@0    db    'mov',HT,0,',al',0
  1267. IB86@1    db    'mov',HT,0,',bx',0
  1268.  
  1269. CN86    db    'jz ',0,0
  1270.     db    'jnz ',00
  1271.     db    'jc ',0,0
  1272.     db    'jnc ',00
  1273.     db    'jpe ',00
  1274.     db    'jpo ',00
  1275.     db    'js ',0,0
  1276.     db    'jns ',00
  1277.  
  1278. excl    db    ' ! ',00
  1279.  
  1280. CR86    db    'ret',0
  1281. CJ86    db    'jmp ',0
  1282. CC86    db    'call ',0
  1283.  
  1284. DB86    db    'db',HT,0
  1285. DW86    db    'dw',HT,0
  1286. RB86    db    'rb',HT,0
  1287. RW86    db    'rw',HT,'1',0
  1288. EQ86    db    'equ',HT,0
  1289. OR86    db    'org',HT,0
  1290. EN86    db    'end',0
  1291.  
  1292. ER86    db    '[-error-]',0
  1293.  
  1294. logo    db    '          80T86/ICUAP',CR,LF
  1295.     db    'Universidad Autonoma de Puebla',CR,LF
  1296.     db    '        August 28, 1984',CR,LF,'$'
  1297.  
  1298. tuto    db    '80T86 will translate .ASM files for the Intel 8080',CR,LF
  1299.     db    'into .A86 files for the Intel 8086.',CR,LF
  1300.     db    CR,LF
  1301.     db    '          80T86 [X:]FILE[.XXX]',CR,LF
  1302.     db    CR,LF
  1303.     db    'will read [X:]FILE[.XXX] to produce [X:]FILE.A86.',CR,LF
  1304.     db    'All operation codes and the assembler directives',CR,LF
  1305.     db    'db, dw, ds, equ, org, end will be translated, but',CR,LF
  1306.     db    'many constructions will have to be transformed by',CR,LF
  1307.     db    'hand afterwards. These include <call BDOS>, colons',CR,LF
  1308.     db    'in the labels of db''s, dw''s and ds''s, labels which',CR,LF
  1309.     db    'conflict with Intel 8086 opcodes or directives, dollar',CR,LF
  1310.     db    'signs which form part of labels, asolute addresses',CR,LF
  1311.     db    'such as CP/M''s file control block, and so on. The',CR,LF
  1312.     db    'source file may be squeezed.',CR,LF
  1313.     db    '$'
  1314.  
  1315. werr    db    CR,LF,'Disk write error.$'
  1316. nfil    db    CR,LF,'Requested file not present.$'
  1317. yexi    db    CR,LF,'.A86 file already exists.$'
  1318. ntab    db    CR,LF,'Insufficient space for dictionary.$'
  1319. nasm    db    CR,LF,'Not an .ASM file.$'
  1320. chno    db    CR,LF,'Checksum failure.$'
  1321. nopn    db    CR,LF,'Can''t open source.$'
  1322. nodi    db    CR,LF,'Disk or Directory full.$'
  1323. nclo    db    CR,LF,'Cannot close file.$'
  1324.  
  1325. gsym    db    'G000',00
  1326.  
  1327. FC86    rb    21H        ;.A86 FCB
  1328. CO86    rb    1        ;occupancy of .A86 buffer
  1329. PT86    rw    1        ;pointer to .A86 buffer
  1330. BU86    rb    SZ86        ;.A86 buffer
  1331. lach    rb    1        ;last character typed
  1332. sepr    rb    1        ;last separator read
  1333. roco    rb    1        ;rotating bit counter
  1334. roby    rb    1        ;rotating byte
  1335. dens    rb    1        ;z/nz = un/squeezed
  1336. mult    rb    1        ;repeat factor
  1337. xait    rb    1        ;z/nz = character not/waiting
  1338. wach    rb    1        ;waiting character
  1339. CO80    rw    1        ;byte counter - input buffer
  1340. PT80    rw    1        ;byte pointer - input buffer
  1341. cksm    rw    1        ;checksum
  1342. code    rb    4*csiz        ;decoding table
  1343. stak    rw    1        ;stackend
  1344.  
  1345.     end
  1346.